<%@ taglib uri="/WEB-INF/myfaces_html.tld" 	prefix="h" %>
<%@ taglib uri="/WEB-INF/myfaces_core.tld" 	prefix="f" %>
<%@ taglib uri="/WEB-INF/tomahawk.tld"     	prefix="t" %>
<%@ page import="java.util.ArrayList" %>

<f:view>
    <jsp:include page="/intestazione.jsp">
        <jsp:param name="titolo" value="Gestione Rubrica"/>
    </jsp:include>
    <jsp:include page="/menu.jsp"/>
    <script language="javascript" src="./script/popup_full_center.js"></script>
    <script language="javascript" src="./script/confirmCM.js"></script>    
    <script language="javascript" src="./script/ripristinoSessione.js"></script>    
   
    <br />
    <table class="find" style="border: 2pt solid white; margin-bottom: -10px">
        <hr />
        <tr>  
            <td class="intestazionePagina" align="center">
            <strong>GESTIONE RUBRICA</strong></td>                        
        </tr>        
    </table>
    
    <t:saveState value="#{beanRubrica}"/>
    <h:form binding="#{dettaglioRubrica.form}" id="formLookup">         
        <table class="dettaglio">
            <tbody>           
            <tr>                   
                <td class="etichettaDettaglio"><strong><t:outputLabel for="codice" value="Codice"/></strong></td>
                <td><t:inputText id="codice" value="#{beanRubrica.codice}" size="10" maxlength="5" styleClass="dettaglio_InputText" immediate="true" disabled="true"/></td>
            </tr>              

            <tr>                   
                <td class="etichettaDettaglio"><strong><t:outputLabel for="cognome" value="Cognome(*)"/></strong></td>
                <td><t:inputText id="cognome" value="#{beanRubrica.cognome}" styleClass="dettaglio_InputText" onchange="this.value=this.value.toUpperCase()" size="40" maxlength="50" required="true"/>
                <br/><h:message style="color: red" for="cognome" showDetail="true" showSummary="false" /></td>
            </tr>            
            
            <tr>                   
                <td class="etichettaDettaglio"><strong><t:outputLabel for="nome" value="Nome(*)"/></strong></td>
                <td><t:inputText id="nome" value="#{beanRubrica.nome}" styleClass="dettaglio_InputText" onchange="this.value=this.value.toUpperCase()" size="40" maxlength="50" required="true"/>
                <br/><h:message style="color: red" for="nome" showDetail="true" showSummary="false" /></td>
            </tr>       
             
            <tr>                   
                <td class="etichettaDettaglio"><strong><t:outputLabel for="indirizzo" value="Indirizzo"/></strong></td>
                <td><t:inputText id="indirizzo" value="#{beanRubrica.indirizzo}" styleClass="dettaglio_InputText" onchange="this.value=this.value.toUpperCase()" size="50" maxlength="100" required="false"/>
                <br/><h:message style="color: red" for="indirizzo" showDetail="true" showSummary="false" /></td>
            </tr>  
            
            <tr>
                <td class="etichettaDettaglio"><strong><t:outputLabel for="descrizioneComune" value="Comune" /></strong></td>
                <td colspan="2">
                    <t:inputText id="descrizioneComune" value="#{beanRubrica.beanComune.descrizione}" onchange="submit()" valueChangeListener="#{dettaglioRubrica.lookUp}" size="45" styleClass="dettaglio_InputText">
                        <f:attribute name="nomeBean" value="beanComune" />
                        <f:attribute name="nomeBeanLookUp" value="Comune" />
                    </t:inputText>
                    <t:inputText id="cap" value="#{beanRubrica.beanComune.cap}" styleClass="dettaglio_InputText" size="5" disabled="true"/>
                </td>              
                <td>                
                    <t:commandLink id="cercaLookup2" onclick="loadurl('lookup/lookupComuni.jsf?lookup=descrizioneComune');" immediate="true">
                        <t:graphicImage url="image/system-search.png" border="0" title="Cerca Elemento"/>
                    </t:commandLink>
                </td><td>
                    <t:commandLink action="#{dettaglioRubrica.svuotaLookup}" title="Svuota" rendered="#{beanRubrica.beanComune.id ne null}">
                        <t:graphicImage url="image/edit-redo.png" border="0" title="Indietro"/>
                        <f:param name="bean" value="beanComune"/>                        
                    </t:commandLink>
                </td>
            </tr>            
         
            <tr>                   
                <td class="etichettaDettaglio"><strong><t:outputLabel for="professione" value="Professione"/></strong></td>
                <td><t:inputText id="professione" value="#{beanRubrica.professione}" styleClass="dettaglio_InputText" onchange="this.value=this.value.toUpperCase()" size="50" maxlength="70" required="false"/>
                <br/><h:message style="color: red" for="professione" showDetail="true" showSummary="false" /></td>
            </tr>  
            
            <tr>                   
                <td class="etichettaDettaglio"><strong><t:outputLabel for="numTelefono1" value="Telefono 1"/></strong></td>
                <td><t:inputText id="numTelefono1" value="#{beanRubrica.numTelefono1}" styleClass="dettaglio_InputText" onchange="this.value=this.value.toUpperCase()" size="20" maxlength="15" required="false"/>
                <br/><h:message style="color: red" for="numTelefono1" showDetail="true" showSummary="false" /></td>
           
                <td class="etichettaDettaglio"><strong><t:outputLabel for="numTelefono2" value="Telefono 2"/></strong></td>
                <td><t:inputText id="numTelefono2" value="#{beanRubrica.numTelefono2}" styleClass="dettaglio_InputText" onchange="this.value=this.value.toUpperCase()" size="20" maxlength="15" required="false"/>
                <br/><h:message style="color: red" for="numTelefono2" showDetail="true" showSummary="false" /></td>
            </tr>  
        
            <tr>                   
                <td class="etichettaDettaglio"><strong><t:outputLabel for="numCellulare1" value="Cellulare 1"/></strong></td>
                <td><t:inputText id="numCellulare1" value="#{beanRubrica.numCellulare1}" styleClass="dettaglio_InputText" onchange="this.value=this.value.toUpperCase()" size="20" maxlength="15" required="false"/>
                <br/><h:message style="color: red" for="numCellulare1" showDetail="true" showSummary="false" /></td>
           
                <td class="etichettaDettaglio"><strong><t:outputLabel for="numCellulare2" value="Cellulare 2"/></strong></td>
                <td><t:inputText id="numCellulare2" value="#{beanRubrica.numCellulare2}" styleClass="dettaglio_InputText" onchange="this.value=this.value.toUpperCase()" size="20" maxlength="15" required="false"/>
                <br/><h:message style="color: red" for="numCellulare2" showDetail="true" showSummary="false" /></td>
            </tr>   
            
            <tr>                   
                <td class="etichettaDettaglio"><strong><t:outputLabel for="email" value="Email"/></strong></td>
                <td colspan="3"><t:inputText id="email" value="#{beanRubrica.email}" styleClass="dettaglio_InputText" onchange="this.value=this.value.toUpperCase()" size="80" maxlength="100" />
                <br/><h:message style="color: red" for="email" showDetail="true" showSummary="false" /></td>
            </tr>  
            
            <tr>                   
                <td class="etichettaDettaglio"><strong><t:outputLabel for="web" value="Web"/></strong></td>
                <td colspan="3"><t:inputText id="web" value="#{beanRubrica.web}" styleClass="dettaglio_InputText" onchange="this.value=this.value.toUpperCase()" size="80" maxlength="100" />
                <br/><h:message style="color: red" for="web" showDetail="true" showSummary="false" /></td>
            </tr>  
        </table>
        <br/>
        <t:inputHidden value="#{beanRubrica.id}"/>
        <table bgcolor="#FFFFFF" width="750px">
            <tr>     
                <td>
                    <h:commandLink styleClass="commandLink_Style" dir="RTL" action="benvenuto" immediate="true">
                        <t:graphicImage url="/image/go-home.png" border="0"/>
                    </h:commandLink>              
                </td>   
                <td>
                    <t:commandLink action="#{dettaglioRubrica.primo}"  rendered="#{beanRubrica.id ne null}">
                        <t:graphicImage url="image/primo.png" border="0" title="Vai al primo elemento"/>
                        <f:param name="bean" value="beanRubrica"/>                        
                        <f:param name="id" value="#{beanRubrica.id}"/>                 
                    </t:commandLink>
                </td>
                <td>
                    <t:commandLink action="#{dettaglioRubrica.precedente}" rendered="#{beanRubrica.id ne null}">
                        <t:graphicImage url="image/indietro.png" border="0" title="Indietro"/>
                        <f:param name="bean" value="beanRubrica"/>                        
                        <f:param name="id" value="#{beanRubrica.id}"/>                 
                    </t:commandLink>
                </td>
                <td>
                    <t:commandLink action="#{dettaglioRubrica.successivo}" rendered="#{beanRubrica.id ne null}">
                        <t:graphicImage url="image/avanti.png" border="0" title="Avanti"/>
                        <f:param name="bean" value="beanRubrica"/>                        
                        <f:param name="id" value="#{beanRubrica.id}"/>                 
                    </t:commandLink>
                </td>
                <td>
                    <t:commandLink action="#{dettaglioRubrica.ultimo}" rendered="#{beanRubrica.id ne null}">
                        <t:graphicImage url="image/ultimo.png" border="0" title="Vai all'ultimo elemento"/>
                        <f:param name="bean" value="beanRubrica"/>                        
                        <f:param name="id" value="#{beanRubrica.id}"/>                 
                    </t:commandLink>
                </td>
                <td>
                    <h:commandLink dir="RTL" onmousedown="return confirmDelete(this);" title="cancella" action="#{dettaglioRubrica.cancella}" rendered="#{beanRubrica.id ne null}">
                        <t:graphicImage url="image/stop.png" border="0" title="Cancella"/>
                        <f:param name="bean" value="beanRubrica" />
                    </h:commandLink>                
                </td>                               
                <td>
                    <h:commandLink dir="RTL" onmousedown="return confirmUpdate(this);" title="modifica" action="#{dettaglioRubrica.modifica}" rendered="#{beanRubrica.id ne null}">
                        <t:graphicImage url="image/salva.png" border="0" title="Salva modifiche"/>
                        <f:param name="bean" value="beanRubrica" />
                    </h:commandLink>                
                </td>    
                <td>
                    <h:commandLink dir="RTL" onmousedown="return confirmSave(this);" title="salva inserimento" action="#{dettaglioRubrica.inserisci}" rendered="#{beanRubrica.id eq null}">
                        <t:graphicImage url="image/salva.png" border="0" title="Salva inserimento"/>
                        <f:param name="bean" value="beanRubrica" />
                    </h:commandLink>                
                </td> 
                <%--
                <td>
                <h:commandLink dir="RTL" title="Annulla operazione" action="#{dettaglioRubrica.annulla}" rendered="#{beanRubrica.id eq null}" immediate="true">
                <t:graphicImage url="image/delete.png" border="0"/>
                <f:param name="bean" value="beanRubrica" />
                </h:commandLink>                     
                </td>
                --%>
                <td>
                    <h:commandLink dir="RTL" title="inserisce nuovo elemento" action="#{dettaglioRubrica.inserisciDettaglio}" rendered="#{beanRubrica.id ne null}">
                        <t:graphicImage url="image/nuovo.png" border="0" title="Inserisci NUOVO"/>
                        <f:param name="bean" value="beanRubrica" />
                    </h:commandLink>
                </td>
                
                <td>
                    <h:commandLink  title="LISTA" id="lista" action="#{dettaglioRubrica.lista}" rendered="#{beanRubrica.id ne null}">
                        <t:graphicImage url="image/lista.png" border="0" title="Carica lista" style="width:32px; height:32px"/>
                        <f:param name="bean" value="Rubrica" />
                    </h:commandLink>
                </td>
                
                <td>                
                    <t:commandLink id="cerca1" onclick="loadurl('pages_ricerca/ricercaRubrica.jsf');" immediate="true" rendered="#{beanRubrica.id ne null}">
                        <t:graphicImage url="image/find.png" border="0" title="Cerca Elemento" style="width:32px; height:32px"/>
                    </t:commandLink>
                </td>        
            </tr>
        </table>
    </h:form> 
    
    <h:form id="erroriDataBase" rendered="false">
        <f:verbatim><table><td align="left" class="messaggiErrore" height="2px"></f:verbatim>           
        <h:messages style="color: red" showDetail="true" showSummary="false"/>
        <f:verbatim></td></table></f:verbatim>
    </h:form>     
    
    <jsp:include page="/piePagina.jsp"/>      
</f:view>